import java.util.Scanner;

/**
 * DomWon
 * Created with Intellij IDEA.
 * Description:
 * User:WEI
 * Date:2023/3/3
 * Time:9:35
 */
public class Test {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        odd(a);
        System.out.println();
        even(a);
    }
    public static void odd(int num) {
        for (int i = 30; i >= 0; i = i - 2) {
            if ((num & (1 << i)) != 0) {
                System.out.print("1 ");
            } else {
                System.out.print("0 ");
            }
        }
    }
    public static void even(int num) {
        for (int i = 31; i >= 0; i = i - 2) {
            if ((num & (1 << i)) != 0) {
                System.out.print("1 ");
            } else {
                System.out.print("0 ");
            }
        }
    }
    public static void main9(String[] args) {
        Scanner scan = new Scanner(System.in);
        int password = 123456;
        int count = 0;
        while(true) {
            int a= scan.nextInt();
            if(a != password) {
                System.out.println("输入错误，请重新输入！");
            }
            count++;
            if(count == 3) {
                System.out.println("退出程序！");
                break;
            }
        }
    }

    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        while(a != 0) {
            System.out.print(a%10 +" ");
            a /= 10;
        }
    }

    public static void main7(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        for (int i = 1; i <= a; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j + "=" + (i*j) + " ");
            }
            System.out.println();
        }
    }

    public static void main6(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if(i / 10 == 9) {
                count++;
            }
            if(i % 10 == 9) {
                count++;
            }
        }
        System.out.println(count);
    }
    
    public static void main5(String[] args) {
        for (int i = 1000; i < 2000; i++) {
            if((i % 4 == 0 && i % 100 != 0)||(i % 400 == 0)) {
                System.out.println(i);
            }
        }
    }

    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        for (int i = 2; i <= 100 ; i++) {
            int j = 2;
            for (j = 2; j < i; j++) {
                if(i % j == 0) {
                    break;
                }
            }
            if(i == j) {
                System.out.print(i+" ");
            }
        }
    }

    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int flag = 1;
        for (int i = 2; i < Math.sqrt(a); i++) {
            if(a % i == 0) {
                System.out.println(a + "不是素数");
                flag = 0;
                break;
            }
        }
        if(flag == 1) {
            System.out.println(a + "是素数");
        }
    }

    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        System.out.println(a);
    }

    public static void main1(String[] args) {
        int i = 0;
        for(i = 0;i < 10;i++){
            if(i%3 == 0){
                System.out.println(i);
            }
        }
    }
}
